/*
 * FontChooser.java  0.4.0 / Oct 26, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing;

import com.cute4j.swing.graphics.Font;

/**
 * Font Chooser Component.
 *
 * @cute4j.native
 *    generate="header"
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public final class FontChooser extends Dialog {

// Private Constructor. --------------------------------------------------------

 /**
  * Class has no instances.
  */
  private FontChooser() {
    // empty constructor body
  }

// Public Static Methods. ------------------------------------------------------

  /**
   * Returns font selected by the user.
   *
   * @param parent the parent component
   *
   * @return font selected by the user
   */
  public static Font getFont(Component parent) {
    return getFont(parent, null, null);
  }

  /**
   * Returns font selected by the user.
   *
   * @param parent the parent component
   * @param initialFont the initial font
   *
   * @return font selected by the user
   */
  public static Font getFont(Component parent, Font initialFont) {
    return getFont(parent, initialFont, null);
  }

  /**
   * Returns font selected by the user.
   *
   * @param parent the parent component
   * @param initialFont the initial font
   * @param title the dialog title
   *
   * @return font selected by the user
   */
  public static Font getFont(Component parent, Font initialFont,
                             String title) {
    if (parent != null) {
      return _getFont(parent._delegate, initialFont, title);
    }
    return _getFont(0, initialFont, title);
  }

// Package-Private Static Native Method. ---------------------------------------

  static native Font _getFont(long parentDelegate, Font initialFont,
                              String title);

}
